<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>info</title>
    <script src="https://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>

    <script>
        // 页面加载完毕之后，马上就执行逻辑
        $(function () {
            $("#btn1").click(function () {
                //发起异步请求，查单个
                $.get("/employees/1",function (data){
                    console.log(data)
                })
            })
            $("#btn2").click(function () {
                //发起异步请求，查多个
                $.get("/employees",function (data){
                    console.log(data)
                })
            })
            $("#btn3").click(function () {
                //发起异步请求，添加
                $.post("/employees",{name:"dafei", age:18},function (data){
                    console.log(data)
                })
            })
            $("#btn4").click(function () {
                //发起异步请求，添加
                $.ajax({
                    url:"/employees",
                    type:"PUT",
                    data:{id:1, name:"dafei", age:18},
                    success: function (data) {
                        console.log(data);
                    }
                })
            })
            $("#btn5").click(function () {
                //发起异步请求，添加
                $.ajax({
                    url:"/employees",
                    type:"DELETE",
                    data:{id:1},
                    success: function (data) {
                        console.log(data);
                    }
                })
            })
        })
    </script>
</head>
<body>

    <button id="btn1">查单个</button>
    <button id="btn2">查多个</button>
    <button id="btn3">添加</button>
    <button id="btn4">更新</button>
    <button id="btn5">删除</button>

</body>
</html>